package com.ticket.system.service.impl;

import java.util.List;
import com.ticket.common.utils.DateUtils;
import com.ticket.system.domain.enu.PointsEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ticket.system.mapper.YanchuScoreDetailMapper;
import com.ticket.system.domain.YanchuScoreDetail;
import com.ticket.system.service.IYanchuScoreDetailService;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-18
 */
@Service
public class YanchuScoreDetailServiceImpl implements IYanchuScoreDetailService 
{
    @Autowired
    private YanchuScoreDetailMapper yanchuScoreDetailMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public YanchuScoreDetail selectYanchuScoreDetailById(Long id)
    {
        return yanchuScoreDetailMapper.selectYanchuScoreDetailById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param yanchuScoreDetail 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<YanchuScoreDetail> selectYanchuScoreDetailList(YanchuScoreDetail yanchuScoreDetail)
    {
        List<YanchuScoreDetail> yanchuScoreDetails = yanchuScoreDetailMapper.selectYanchuScoreDetailList(yanchuScoreDetail);
        yanchuScoreDetails.forEach(userscore ->{
            userscore.setPointRuleName(PointsEnum.indexOf(userscore.getPointRuleType()).getValue());
        });
        return yanchuScoreDetails;
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param yanchuScoreDetail 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertYanchuScoreDetail(YanchuScoreDetail yanchuScoreDetail)
    {
        yanchuScoreDetail.setCreateTime(DateUtils.getNowDate());
        return yanchuScoreDetailMapper.insertYanchuScoreDetail(yanchuScoreDetail);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param yanchuScoreDetail 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateYanchuScoreDetail(YanchuScoreDetail yanchuScoreDetail)
    {
        yanchuScoreDetail.setUpdateTime(DateUtils.getNowDate());
        return yanchuScoreDetailMapper.updateYanchuScoreDetail(yanchuScoreDetail);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteYanchuScoreDetailByIds(Long[] ids)
    {
        return yanchuScoreDetailMapper.deleteYanchuScoreDetailByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteYanchuScoreDetailById(Long id)
    {
        return yanchuScoreDetailMapper.deleteYanchuScoreDetailById(id);
    }
}
